import { createRouter, createWebHashHistory } from 'vue-router';

import Layout from '../views/Layout.vue';
import Home from '../views/home/index.vue';
import User from '../views/user/index.vue';
import Order from '../views/order/index.vue'
import Login from '../views/login/index.vue'

const routes = [
    {
        path: '/',
        component: Layout,
        redirect: '/home',
        children: [
            {
                path: 'home',
                component: Home,
                meta: {
                    name: '首页',
                    icon: 'home-o'
                }
            },
            {
                path: 'order',
                component: Order,
                meta: {
                    name: '订单',
                    icon: 'orders-o'
                }
            },
            {
                path: 'user',
                component: User,
                meta: {
                    name: '我的',
                    icon: 'user-circle-o'
                }
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: Login
    }
]

export default createRouter({
    history: createWebHashHistory(),
    routes
})